<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>JDK工具 | lilei</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/images/icons/logo.png">
    <link rel="apple-touch-icon" href="/images/icons/logo.png">
    <link rel="manifest" href="/manifest.json">
    <script type="text/javascript" src="/assets/js/load.js"></script>
    <meta name="description" content="个人网站">
    <meta name="image" content="http://www.lileiblog.xyz/images/JDK-bin.png">
    <meta name="twitter:title" content="JDK工具">
    <meta name="twitter:description" content="">
    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:image" content="http://www.lileiblog.xyz/images/JDK-bin.png">
    <meta name="twitter:url" content="http://www.lileiblog.xyz/Java/JDK%E5%B7%A5%E5%85%B7.html">
    <meta property="og:type" content="article">
    <meta property="og:title" content="JDK工具">
    <meta property="og:description" content="">
    <meta property="og:image" content="http://www.lileiblog.xyz/images/JDK-bin.png">
    <meta property="og:url" content="http://www.lileiblog.xyz/Java/JDK%E5%B7%A5%E5%85%B7.html">
    <meta property="og:site_name" content="lilei">
    <meta itemprop="name" content="JDK工具">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="http://www.lileiblog.xyz/images/JDK-bin.png">
    <meta name="theme-color" content="#3eaf7c">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="msapplication-TileImage" content="/images/icons/logo.png">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="keywords" content="lilei,vue,vuepress,vuepress-theme,theme,主题,vuepress主题,blog
        ,vuepress-blog,java,python,shell,sql,golang,script,shell script,nginx,windows,去广告,androd,google drive
        ,one drive,idea,eclipse,git,小程序">
    <meta name="referrer" content="never">
    
    <link rel="preload" href="/assets/css/0.styles.8932179b.css" as="style"><link rel="preload" href="/assets/js/app.269009d6.js" as="script"><link rel="preload" href="/assets/js/3.974b9720.js" as="script"><link rel="preload" href="/assets/js/26.da141fb8.js" as="script"><link rel="prefetch" href="/assets/js/10.5915e99b.js"><link rel="prefetch" href="/assets/js/11.ff732762.js"><link rel="prefetch" href="/assets/js/12.8bb86d91.js"><link rel="prefetch" href="/assets/js/13.18bde5b0.js"><link rel="prefetch" href="/assets/js/14.314fae34.js"><link rel="prefetch" href="/assets/js/15.0a4ff48f.js"><link rel="prefetch" href="/assets/js/16.ffaf1503.js"><link rel="prefetch" href="/assets/js/17.49a31a6e.js"><link rel="prefetch" href="/assets/js/18.7e6443bf.js"><link rel="prefetch" href="/assets/js/19.6880cc9a.js"><link rel="prefetch" href="/assets/js/20.1fb3f255.js"><link rel="prefetch" href="/assets/js/21.0cd39eea.js"><link rel="prefetch" href="/assets/js/22.392d85cb.js"><link rel="prefetch" href="/assets/js/23.f50adb15.js"><link rel="prefetch" href="/assets/js/24.43e324e1.js"><link rel="prefetch" href="/assets/js/25.e3663205.js"><link rel="prefetch" href="/assets/js/27.6c05235a.js"><link rel="prefetch" href="/assets/js/28.c124245a.js"><link rel="prefetch" href="/assets/js/29.d185870d.js"><link rel="prefetch" href="/assets/js/30.8587d422.js"><link rel="prefetch" href="/assets/js/31.dc382b56.js"><link rel="prefetch" href="/assets/js/32.20ba32e9.js"><link rel="prefetch" href="/assets/js/33.6ecd7de9.js"><link rel="prefetch" href="/assets/js/34.2b91c13a.js"><link rel="prefetch" href="/assets/js/35.66ed0733.js"><link rel="prefetch" href="/assets/js/36.ce7bca84.js"><link rel="prefetch" href="/assets/js/37.d00bb5ac.js"><link rel="prefetch" href="/assets/js/38.c3ecbb6f.js"><link rel="prefetch" href="/assets/js/39.308f4175.js"><link rel="prefetch" href="/assets/js/4.520f6ecc.js"><link rel="prefetch" href="/assets/js/40.f4b98bc2.js"><link rel="prefetch" href="/assets/js/41.95fae64f.js"><link rel="prefetch" href="/assets/js/42.fe4f877b.js"><link rel="prefetch" href="/assets/js/43.ca8f222e.js"><link rel="prefetch" href="/assets/js/44.4d4ee79e.js"><link rel="prefetch" href="/assets/js/45.79178b33.js"><link rel="prefetch" href="/assets/js/46.c3817d0b.js"><link rel="prefetch" href="/assets/js/47.b8252443.js"><link rel="prefetch" href="/assets/js/48.df9d5d3b.js"><link rel="prefetch" href="/assets/js/49.d812fdb2.js"><link rel="prefetch" href="/assets/js/5.f1a24a16.js"><link rel="prefetch" href="/assets/js/50.55cfcaa8.js"><link rel="prefetch" href="/assets/js/51.b8608b02.js"><link rel="prefetch" href="/assets/js/52.52c5e00d.js"><link rel="prefetch" href="/assets/js/53.3a9bd5fb.js"><link rel="prefetch" href="/assets/js/54.a4240c13.js"><link rel="prefetch" href="/assets/js/55.01c4b876.js"><link rel="prefetch" href="/assets/js/56.f29549a3.js"><link rel="prefetch" href="/assets/js/57.01438a04.js"><link rel="prefetch" href="/assets/js/58.29bb4626.js"><link rel="prefetch" href="/assets/js/59.e8b89408.js"><link rel="prefetch" href="/assets/js/6.8c478b39.js"><link rel="prefetch" href="/assets/js/60.bedb5381.js"><link rel="prefetch" href="/assets/js/61.bdfbe584.js"><link rel="prefetch" href="/assets/js/62.cb825d1a.js"><link rel="prefetch" href="/assets/js/63.a9516572.js"><link rel="prefetch" href="/assets/js/64.aa854ed7.js"><link rel="prefetch" href="/assets/js/65.285f883d.js"><link rel="prefetch" href="/assets/js/66.12849f37.js"><link rel="prefetch" href="/assets/js/67.c18b00e4.js"><link rel="prefetch" href="/assets/js/68.fa59daa9.js"><link rel="prefetch" href="/assets/js/69.e9d5dda4.js"><link rel="prefetch" href="/assets/js/7.cfb0d0ea.js"><link rel="prefetch" href="/assets/js/70.db126cce.js"><link rel="prefetch" href="/assets/js/71.6acb04cd.js"><link rel="prefetch" href="/assets/js/72.7ff0ab11.js"><link rel="prefetch" href="/assets/js/73.9a66da79.js"><link rel="prefetch" href="/assets/js/74.0a38a030.js"><link rel="prefetch" href="/assets/js/75.7b32dbb3.js"><link rel="prefetch" href="/assets/js/8.cb9c08e5.js"><link rel="prefetch" href="/assets/js/9.ad652cfe.js"><link rel="prefetch" href="/assets/js/vendors~flowchart.110a1065.js">
    <link rel="stylesheet" href="/assets/css/0.styles.8932179b.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="/images/icons/logo.png" alt="lilei" class="logo"> <span class="site-name can-hide">lilei</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/Form/" class="nav-link">
  Form
</a></div><div class="nav-item"><a href="/IDE/" class="nav-link">
  IDE
</a></div><div class="nav-item"><a href="/Java/" class="nav-link router-link-active">
  Java
</a></div><div class="nav-item"><a href="/Other/" class="nav-link">
  Other
</a></div><div class="nav-item"><a href="/Python/" class="nav-link">
  Python
</a></div><div class="nav-item"><a href="/SQL/" class="nav-link">
  SQL
</a></div><div class="nav-item"><a href="/Shell/" class="nav-link">
  Shell
</a></div><div class="nav-item"><a href="/System/" class="nav-link">
  System
</a></div> <a href="https://github.com/woytu/notes-vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/Form/" class="nav-link">
  Form
</a></div><div class="nav-item"><a href="/IDE/" class="nav-link">
  IDE
</a></div><div class="nav-item"><a href="/Java/" class="nav-link router-link-active">
  Java
</a></div><div class="nav-item"><a href="/Other/" class="nav-link">
  Other
</a></div><div class="nav-item"><a href="/Python/" class="nav-link">
  Python
</a></div><div class="nav-item"><a href="/SQL/" class="nav-link">
  SQL
</a></div><div class="nav-item"><a href="/Shell/" class="nav-link">
  Shell
</a></div><div class="nav-item"><a href="/System/" class="nav-link">
  System
</a></div> <a href="https://github.com/woytu/notes-vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>Java</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/Java/" aria-current="page" class="sidebar-link">Java</a></li><li><a href="/Java/Annotation.html" class="sidebar-link">Annotation</a></li><li><a href="/Java/JDK安装配置.html" class="sidebar-link">JDK安装配置</a></li><li><a href="/Java/JDK工具.html" class="active sidebar-link">JDK工具</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/Java/JDK工具.html#flag" class="sidebar-link">Flag</a></li><li class="sidebar-sub-header"><a href="/Java/JDK工具.html#反编译工具" class="sidebar-link">反编译工具</a></li><li class="sidebar-sub-header"><a href="/Java/JDK工具.html#tools" class="sidebar-link">tools</a></li><li class="sidebar-sub-header"><a href="/Java/JDK工具.html#远程监控参数" class="sidebar-link">远程监控参数</a></li><li class="sidebar-sub-header"><a href="/Java/JDK工具.html#远程debug参数" class="sidebar-link">远程Debug参数</a></li></ul></li><li><a href="/Java/Java构建管理.html" class="sidebar-link">Java构建管理</a></li><li><a href="/Java/Java笔记.html" class="sidebar-link">Java笔记</a></li><li><a href="/Java/ORM.html" class="sidebar-link">ORM</a></li><li><a href="/Java/SPI.html" class="sidebar-link">SPI</a></li><li><a href="/Java/Spring.html" class="sidebar-link">Spring</a></li><li><a href="/Java/Tomcat.html" class="sidebar-link">Tomcat</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="jdk工具"><a href="#jdk工具" class="header-anchor">#</a> JDK工具</h1> <p></p><div class="table-of-contents"><ul><li><a href="#flag">Flag</a></li><li><a href="#反编译工具">反编译工具</a></li><li><a href="#tools">tools</a><ul><li><a href="#基本工具">基本工具</a></li><li><a href="#安全工具">安全工具</a></li><li><a href="#java国际化工具">Java国际化工具</a></li><li><a href="#远程方法调用工具">远程方法调用工具</a></li><li><a href="#idl和rmi-iiop工具">IDL和RMI-IIOP工具</a></li><li><a href="#java部署工具">Java部署工具</a></li><li><a href="#java-web工具">Java web工具</a></li><li><a href="#jdk监控工具">JDK监控工具</a></li><li><a href="#故障检测和修理工具">故障检测和修理工具</a></li><li><a href="#其他工具">其他工具</a></li></ul></li><li><a href="#远程监控参数">远程监控参数</a></li><li><a href="#远程debug参数">远程Debug参数</a></li></ul></div><p></p> <h2 id="flag"><a href="#flag" class="header-anchor">#</a> Flag</h2> <ul><li><a href="https://docs.oracle.com/javase/8/docs/technotes/tools" target="_blank" rel="noopener noreferrer">https://docs.oracle.com/javase/8/docs/technotes/tools<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="http://openjdk.java.net/projects/code-tools" target="_blank" rel="noopener noreferrer">http://openjdk.java.net/projects/code-tools<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/openjdk/jmc" target="_blank" rel="noopener noreferrer">https://github.com/openjdk/jmc<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <ul><li><a href="https://github.com/topics/diagnosis" target="_blank" rel="noopener noreferrer">https://github.com/topics/diagnosis<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/topics/trace" target="_blank" rel="noopener noreferrer">https://github.com/topics/trace<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/topics/agent" target="_blank" rel="noopener noreferrer">https://github.com/topics/agent<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <ul><li>Java诊断利器Arthas <a href="https://github.com/alibaba/arthas" target="_blank" rel="noopener noreferrer">https://github.com/alibaba/arthas<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> <ul><li><a href="https://arthas.aliyun.com/doc/quick-start.html" target="_blank" rel="noopener noreferrer">https://arthas.aliyun.com/doc/quick-start.html<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li> <li><a href="https://github.com/spring-projects/spring-loaded" target="_blank" rel="noopener noreferrer">https://github.com/spring-projects/spring-loaded<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/vipshop/vjtools" target="_blank" rel="noopener noreferrer">https://github.com/vipshop/vjtools<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/qunarcorp/bistoury" target="_blank" rel="noopener noreferrer">https://github.com/qunarcorp/bistoury<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>无侵入式的jvm监控 <a href="https://github.com/ThinkpadNC5/MyPerf4J" target="_blank" rel="noopener noreferrer">https://github.com/ThinkpadNC5/MyPerf4J<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>Java和Android堆转储分析器 <a href="https://heaphero.io" target="_blank" rel="noopener noreferrer">https://heaphero.io<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>GC 日志分析器 <a href="https://gceasy.io" target="_blank" rel="noopener noreferrer">https://gceasy.io<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/chewiebug/GCViewer" target="_blank" rel="noopener noreferrer">https://github.com/chewiebug/GCViewer<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>java程序跟踪工具 <a href="https://github.com/btraceio/btrace" target="_blank" rel="noopener noreferrer">https://github.com/btraceio/btrace<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>故障排除，监视和性能分析 <a href="https://github.com/aragozin/jvm-tools" target="_blank" rel="noopener noreferrer">https://github.com/aragozin/jvm-tools<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/ajermakovics/jvm-mon" target="_blank" rel="noopener noreferrer">https://github.com/ajermakovics/jvm-mon<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/saleson/fm-dynamic-compiler" target="_blank" rel="noopener noreferrer">https://github.com/saleson/fm-dynamic-compiler<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/gperftools/gperftools" target="_blank" rel="noopener noreferrer">https://github.com/gperftools/gperftools<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://www.yourkit.com/java/profiler" target="_blank" rel="noopener noreferrer">https://www.yourkit.com/java/profiler<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>内存分析 <a href="https://projects.eclipse.org/projects/tools.mat" target="_blank" rel="noopener noreferrer">https://projects.eclipse.org/projects/tools.mat<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> <ul><li><a href="https://github.com/vlsi/mat-calcite-plugin" target="_blank" rel="noopener noreferrer">https://github.com/vlsi/mat-calcite-plugin<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li></ul> <ul><li><a href="https://imshuai.com/using-javac" target="_blank" rel="noopener noreferrer">抛开IDE，了解一下javac如何编译<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://www.cnblogs.com/ZiYangZhou/p/8536828.html" target="_blank" rel="noopener noreferrer">使用javac编译工程<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <p><strong>其他命令</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># 获取当前JVM默认参数</span>
java -XX:+PrintFlagsFinal -version <span class="token operator">|</span> <span class="token function">grep</span> MaxHeapSize

<span class="token comment"># 找出占用CPU高（或执行时间长）的线程PID</span>
<span class="token function">top</span> -H -p <span class="token variable"><span class="token variable">$(</span>pgrep java<span class="token variable">)</span></span>
<span class="token function">top</span> -Hp <span class="token variable"><span class="token variable">$(</span>pgrep java<span class="token variable">)</span></span>
<span class="token comment"># TID等同PID</span>
<span class="token function">ps</span> -mp <span class="token variable"><span class="token variable">$(</span>pgrep java<span class="token variable">)</span></span> -o THREAD,tid,time <span class="token operator">|</span> <span class="token function">sort</span> -rn

<span class="token comment"># 打印堆栈异常信息，过滤转换为16进制的PID，-A 30显示后30行</span>
jstack PID <span class="token operator">|</span> <span class="token function">grep</span> <span class="token variable"><span class="token variable">$(</span><span class="token builtin class-name">printf</span> <span class="token string">&quot;%x<span class="token entity" title="\n">\n</span>&quot;</span> PID<span class="token variable">)</span></span> -A <span class="token number">30</span>
jstack PID <span class="token operator">|</span> <span class="token function">grep</span> -A <span class="token number">10</span> <span class="token variable"><span class="token variable">$(</span><span class="token builtin class-name">printf</span> <span class="token string">&quot;%x<span class="token entity" title="\n">\n</span>&quot;</span> PID<span class="token variable">)</span></span>

<span class="token comment"># nid：对应的linux操作系统下的TID，就是前面转化的16进制数字</span>
<span class="token comment"># tid：这个应该是jvm的jmm内存规范中的唯一地址定位</span>

jmap -dump:live,format<span class="token operator">=</span>b,file<span class="token operator">=</span>/tmp/heapdump.hprof PID
/usr/lib/jvm/jdk-YOUR-VERSION/bin/jcmd PID GC.heap_dump /tmp/heapdump.hprof
</code></pre></div><h2 id="反编译工具"><a href="#反编译工具" class="header-anchor">#</a> 反编译工具</h2> <ul><li><a href="https://github.com/topics/reverse-engineering" target="_blank" rel="noopener noreferrer">https://github.com/topics/reverse-engineering<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/topics/decompiler" target="_blank" rel="noopener noreferrer">https://github.com/topics/decompiler<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/topics/disassembler" target="_blank" rel="noopener noreferrer">https://github.com/topics/disassembler<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <ul><li>在线反编译器 <a href="http://www.javadecompilers.com" target="_blank" rel="noopener noreferrer">http://www.javadecompilers.com<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/java-decompiler" target="_blank" rel="noopener noreferrer">https://github.com/java-decompiler<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> <ul><li><a href="https://github.com/java-decompiler/jd-gui" target="_blank" rel="noopener noreferrer">https://github.com/java-decompiler/jd-gui<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler" target="_blank" rel="noopener noreferrer">https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li> <li><a href="https://github.com/leibnitz27/cfr" target="_blank" rel="noopener noreferrer">https://github.com/leibnitz27/cfr<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/mstrobel/procyon" target="_blank" rel="noopener noreferrer">https://github.com/mstrobel/procyon<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> <ul><li>Gui for Procyon <a href="https://github.com/deathmarine/Luyten" target="_blank" rel="noopener noreferrer">https://github.com/deathmarine/Luyten<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li> <li><a href="https://github.com/fesh0r/fernflower" target="_blank" rel="noopener noreferrer">https://github.com/fesh0r/fernflower<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> <ul><li><a href="https://github.com/MinecraftForge/ForgeFlower" target="_blank" rel="noopener noreferrer">https://github.com/MinecraftForge/ForgeFlower<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="http://the.bytecode.club/fernflower.jar" target="_blank" rel="noopener noreferrer">http://the.bytecode.club/fernflower.jar<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></li> <li><a href="https://github.com/MaxPixelStudios/MinecraftDecompiler" target="_blank" rel="noopener noreferrer">https://github.com/MaxPixelStudios/MinecraftDecompiler<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>Jar和APK逆向工程套件 <a href="https://github.com/Konloch/bytecode-viewer" target="_blank" rel="noopener noreferrer">https://github.com/Konloch/bytecode-viewer<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>dex2jar <a href="https://github.com/pxb1988/dex2jar" target="_blank" rel="noopener noreferrer">https://github.com/pxb1988/dex2jar<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/horsicq/DIE-engine" target="_blank" rel="noopener noreferrer">https://github.com/horsicq/DIE-engine<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="http://www.gda.wiki:9090/index.php" target="_blank" rel="noopener noreferrer">http://www.gda.wiki:9090/index.php<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://ghidra-sre.org" target="_blank" rel="noopener noreferrer">https://ghidra-sre.org<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/skylot/jadx" target="_blank" rel="noopener noreferrer">https://github.com/skylot/jadx<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/kwart/jd-cmd" target="_blank" rel="noopener noreferrer">https://github.com/kwart/jd-cmd<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://software.intel.com/articles/pin-a-dynamic-binary-instrumentation-tool" target="_blank" rel="noopener noreferrer">https://software.intel.com/articles/pin-a-dynamic-binary-instrumentation-tool<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/Col-E/Recaf" target="_blank" rel="noopener noreferrer">https://github.com/Col-E/Recaf<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>smali/baksmali <a href="https://github.com/JesusFreke/smali" target="_blank" rel="noopener noreferrer">https://github.com/JesusFreke/smali<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>snowman <a href="https://derevenets.com" target="_blank" rel="noopener noreferrer">https://derevenets.com<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><code>javap -verbose 文件</code> 查看class文件内容 <a href="https://github.com/topics/bytecode" target="_blank" rel="noopener noreferrer">https://github.com/topics/bytecode<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li>字节码查看器 <a href="https://github.com/ingokegel/jclasslib" target="_blank" rel="noopener noreferrer">https://github.com/ingokegel/jclasslib<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/ClassViewer" target="_blank" rel="noopener noreferrer">https://github.com/ClassViewer<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/zxh0/classpy" target="_blank" rel="noopener noreferrer">https://github.com/zxh0/classpy<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <ul><li>反混淆 <a href="https://github.com/java-deobfuscator/deobfuscator" target="_blank" rel="noopener noreferrer">https://github.com/java-deobfuscator/deobfuscator<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <h2 id="tools"><a href="#tools" class="header-anchor">#</a> tools</h2> <blockquote><p>细心的可能会发现，<code>jdk/bin</code>目录下的这些工具都非常小，
是因为这些工具大多是<code>jdk/lib/tools.jar</code>类库的一层包装而已，他们主要的功能代码是在<code>tools</code>类库中实现的。</p></blockquote> <p><img src="/images/JDK-bin.png" alt=""></p> <h3 id="基本工具"><a href="#基本工具" class="header-anchor">#</a> 基本工具</h3> <blockquote><p>这些工具是JDK的基础，用这些工具来编写应用程序。</p></blockquote> <table><thead><tr><th style="text-align:left;">工具名称</th> <th style="text-align:left;">用途</th></tr></thead> <tbody><tr><td style="text-align:left;">javac.exe</td> <td style="text-align:left;">Java语言编译器</td></tr> <tr><td style="text-align:left;">java.exe</td> <td style="text-align:left;">Java应用程序启动器</td></tr> <tr><td style="text-align:left;">javaw.exe</td> <td style="text-align:left;">Java运行工具，用于运行.class字节码文件或.jar文件，但不会显示控制台输出信息，适用于运行图形化程序。</td></tr> <tr><td style="text-align:left;">javadoc.exe</td> <td style="text-align:left;">Java API文档生成器</td></tr> <tr><td style="text-align:left;">apt.exe</td> <td style="text-align:left;">java 注释处理器</td></tr> <tr><td style="text-align:left;">appletviewer.exe</td> <td style="text-align:left;">java applet小程序查看器</td></tr> <tr><td style="text-align:left;">jar.exe</td> <td style="text-align:left;">java文件压缩打包工具</td></tr> <tr><td style="text-align:left;">jdb.exe</td> <td style="text-align:left;">Java调试器</td></tr> <tr><td style="text-align:left;">javah.exe</td> <td style="text-align:left;">C头文件和stub生成器，用于写本地化方法，例如生产JNI样式的头文件</td></tr> <tr><td style="text-align:left;">javap.exe</td> <td style="text-align:left;">class文件反编译工具</td></tr> <tr><td style="text-align:left;">extcheck.exe</td> <td style="text-align:left;">用于检测jar包中的问题</td></tr> <tr><td style="text-align:left;">jcmd.exe</td> <td style="text-align:left;">Java命令行(Java Command)，用于向正在运行的JVM发送诊断命令请求。</td></tr></tbody></table> <h3 id="安全工具"><a href="#安全工具" class="header-anchor">#</a> 安全工具</h3> <blockquote><p>这些工具用于设置系统的安全规则和生产可以工作在远端的安全规则下的应用程序</p></blockquote> <table><thead><tr><th>工具名称</th> <th>用途</th></tr></thead> <tbody><tr><td>keytool.exe</td> <td>管理密钥库和证书</td></tr> <tr><td>jarsigner.exe</td> <td>生产和校验JAR签名</td></tr> <tr><td>policytool.exe</td> <td>有用户界面的规则管理工具</td></tr> <tr><td>kinit.exe</td> <td>用于获得和缓存网络认证协议Kerberos 票证的授予票证</td></tr> <tr><td>klist.exe</td> <td>凭据高速缓存和密钥表中的 Kerberos 显示条目</td></tr> <tr><td>ktab.exe</td> <td>密钥和证书管理工具</td></tr></tbody></table> <h3 id="java国际化工具"><a href="#java国际化工具" class="header-anchor">#</a> Java国际化工具</h3> <blockquote><p>这些工具可以帮助你创建可本地化的应用程序</p></blockquote> <table><thead><tr><th>工具名称</th> <th>用途</th></tr></thead> <tbody><tr><td>native2ascii.exe</td> <td>将文本转化为 Unicode Latin-1</td></tr></tbody></table> <h3 id="远程方法调用工具"><a href="#远程方法调用工具" class="header-anchor">#</a> 远程方法调用工具</h3> <blockquote><p>这些工具可以帮助创建可以和web和网络交互的应用程序</p></blockquote> <table><thead><tr><th>工具名称</th> <th>用途</th></tr></thead> <tbody><tr><td>rmic.exe</td> <td>生成远程对象的stubs and skeletons(存根和框架)</td></tr> <tr><td>rmid.exe</td> <td>Java远程方法调用(RMI:Remote Method Invocation)活化系统守护进程</td></tr> <tr><td>rmiregistry.exe</td> <td>Java远程对象注册表</td></tr> <tr><td>serialver.exe</td> <td>返回类的 serialVersionUID</td></tr> <tr><td>java-rmi.exe</td> <td>Java远程方法调用(Java Remote Method Invocation)工具，主要用于在客户机上调用远程服务器上的对象</td></tr></tbody></table> <h3 id="idl和rmi-iiop工具"><a href="#idl和rmi-iiop工具" class="header-anchor">#</a> IDL和RMI-IIOP工具</h3> <blockquote><p>这些工具用于创建使用OMG-Standard IDL 和 CORBA/IIOP 的应用程序</p></blockquote> <table><thead><tr><th>工具名称</th> <th>用途</th></tr></thead> <tbody><tr><td>tnameserv.exe</td> <td>Java IDL瞬时命名服</td></tr> <tr><td>idlj.exe</td> <td>生产映射到OMG IDL接口可以使Java应用程序使用CORBA的.java文件</td></tr> <tr><td>orbd.exe</td> <td>为客户可以在CORBA环境下透明的定位和调用服务器的稳定的对象提供支持</td></tr> <tr><td>servertool.exe</td> <td>为应用程序提供易于使用的接口用于注册，注销，启动，关闭服务器</td></tr></tbody></table> <h3 id="java部署工具"><a href="#java部署工具" class="header-anchor">#</a> Java部署工具</h3> <table><thead><tr><th>工具名称</th> <th>用途</th></tr></thead> <tbody><tr><td>pack200.exe</td> <td>使用java gzip压缩工具将JAR文件转换为压缩的pack200文件，生产打包文件是高度压缩的JAR包，可以直接部署，减少下载时间</td></tr> <tr><td>unpack200.exe</td> <td>解包pack200文件为JARs</td></tr></tbody></table> <h3 id="java-web工具"><a href="#java-web工具" class="header-anchor">#</a> Java web工具</h3> <table><thead><tr><th>工具名称</th> <th>用途</th></tr></thead> <tbody><tr><td>javaws.exe</td> <td>Java web 启动命令行工具</td></tr> <tr><td>schemagen.exe</td> <td>Java构架的XML Schema生成器</td></tr> <tr><td>wsgen.exe</td> <td>生成 JAX-WS</td></tr> <tr><td>wsimport.exe</td> <td>生成 JAX-WS</td></tr> <tr><td>xjc.exe</td> <td>绑定编译器</td></tr></tbody></table> <h3 id="jdk监控工具"><a href="#jdk监控工具" class="header-anchor">#</a> JDK监控工具</h3> <blockquote><p>Java故障检修，程序概要分析，监视和管理工具</p></blockquote> <table><thead><tr><th>工具名称</th> <th>用途</th></tr></thead> <tbody><tr><td><a href="https://github.com/oracle/visualvm/releases" target="_blank" rel="noopener noreferrer">jvisualvm.exe<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></td> <td>一个图形化的Java虚拟机。从OracleJDK9开始，不再包含。</td></tr> <tr><td>jconsole.exe</td> <td>java监视台和管理控制台</td></tr> <tr><td>jps.exe</td> <td>JVM Process Status进程状态工具。列出目标系统的HotSpot JVM</td></tr> <tr><td>jstat.exe</td> <td>按照命令行的具体要求记录和收集一个JVM的性能数据</td></tr> <tr><td>jstatd.exe</td> <td>JVM jstat 的守护进程</td></tr> <tr><td>jmc.exe</td> <td>Java任务控制工具(Java Mission Control)，主要用于HotSpot JVM的生产时间监测、分析、诊断。从OracleJDK9开始，不再包含。</td></tr></tbody></table> <h4 id="visualvm"><a href="#visualvm" class="header-anchor">#</a> VisualVM</h4> <blockquote><p>从<code>Oracle JDK 9</code>开始，不再包含。需到GitHub下载<a href="https://github.com/oracle/visualvm/releases" target="_blank" rel="noopener noreferrer">https://github.com/oracle/visualvm/releases<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></blockquote> <blockquote><p><code>Oracle JDK 8</code>及以下版本在<code>/jdk/bin</code>目录下<code>jvisualvm.exe</code></p></blockquote> <blockquote><p>需要注意的是:当OS所在分区是FAT格式时，VisualVM无法获取相关信息！</p></blockquote> <ul><li>显示虚拟机进程以及进程的<code>配置</code>、<code>环境信息</code>（<code>jps</code>、<code>jinfo</code>）。</li> <li>监视应用程序的<code>CPU</code>、<code>GC</code>、<code>堆</code>、方法区(1.7及以前)，<code>元空间</code>（JDK1.8及以后）以及<code>线程</code>的信息（<code>jstat</code>、<code>jstack</code>）。</li> <li>dump以及分析<code>堆转储快照</code>（<code>jmap</code>、<code>jhat</code>）。</li> <li>方法级的<code>程序运行性能分析</code>，<strong>找出被调用最多、运行时间最长的方法</strong>。</li> <li>离线程序快照：收集程序的运行时配置、线程dump、内存dump等信息建立一个快照</li></ul> <blockquote><p>参考：<a href="http://blog.51cto.com/zero01/2141942" target="_blank" rel="noopener noreferrer">基于JVisualVM的可视化监控<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>，
<a href="https://blog.csdn.net/u010004317/article/details/82948040" target="_blank" rel="noopener noreferrer">VisualVM监控远程阿里云主机<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></blockquote> <p><strong>不受此JVM支持</strong></p> <blockquote><p>解决<code>Visual GC</code>提示<code>不受此JVM支持</code>，要监控的主机没有配置<code>jstatd</code></p></blockquote> <blockquote><p>参考：<a href="https://blog.csdn.net/liupeifeng3514/article/details/78998161" target="_blank" rel="noopener noreferrer">jvisualvm 连接 jstatd 远程监控 jvm 或 Visual GC提示&quot;不受此JVM支持“<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></blockquote> <ul><li>先查看<code>jstatd</code>服务是否可用</li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code>jps -l <span class="token number">127.0</span>.0.1
</code></pre></div><ul><li>一、在原有配置文件<code>java.policy</code>中添加</li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">vi</span> <span class="token variable">$JAVA_HOME</span>/jre/lib/security/java.policy
</code></pre></div><ul><li>在文件末位的 <code>};</code> 前添加</li></ul> <div class="language-java extra-class"><pre class="language-java"><code>permission <span class="token class-name"><span class="token namespace">java<span class="token punctuation">.</span>security<span class="token punctuation">.</span></span>AllPermission</span><span class="token punctuation">;</span>
</code></pre></div><ul><li>启动jstatd</li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token builtin class-name">cd</span> <span class="token variable">$JAVA_HOME</span>/bin
./jstatd -J-Djava.security.policy<span class="token operator">=</span>all.policy -J-Djava.rmi.server.hostname<span class="token operator">=</span>本服务器IP -p 端口 <span class="token operator">&amp;</span>
</code></pre></div><ul><li>查看运行端口情况</li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">netstat</span> -anp <span class="token operator">|</span> <span class="token function">grep</span> jstatd
<span class="token function">netstat</span> -ntlp
<span class="token function">lsof</span> -i:1099
</code></pre></div><ul><li>二、（推荐）新建一个配置文件<code>jstatd.all.policy</code></li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token builtin class-name">cd</span> <span class="token variable">$JAVA_HOME</span>/bin/
<span class="token function">vi</span> jstatd.all.policy
</code></pre></div><ul><li>添加以下代码</li></ul> <div class="language-java extra-class"><pre class="language-java"><code>grant codebase <span class="token string">&quot;file:${java.home}/../lib/tools.jar&quot;</span> <span class="token punctuation">{</span>
   permission <span class="token class-name"><span class="token namespace">java<span class="token punctuation">.</span>security<span class="token punctuation">.</span></span>AllPermission</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</code></pre></div><ul><li>给文件加上执行权限</li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">chmod</span> +x jstatd.all.policy
</code></pre></div><ul><li>在Java的bin目录下用以下命令启动</li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code>./jstatd -J-Djava.security.policy<span class="token operator">=</span>jstatd.all.policy -J-Djava.rmi.server.hostname<span class="token operator">=</span>本服务器IP -p 端口 -J-Djava.rmi.server.logCalls<span class="token operator">=</span>true <span class="token operator">&amp;</span>
</code></pre></div><ul><li><code>-J-Djava.security.policy=jstatd.all.policy</code> 文件的绝对路径；</li> <li><code>-J-Djava.rmi.server.logCalls=true</code> 打开日志,如果客户端有连接过来的请求,可以监控到,便于排错；</li> <li><code>-J-Djava.rmi.server.hostname=本服务器IP</code> 指明本机 hostname 对应的本机地址,确保该地址可以给客户机访问。
<ul><li>因为有的服务器 hostname 对应的 ip 不一定是外网能连上的，最好在这里直接明确指定；</li></ul></li> <li><code>-p 3333</code> 指定服务的端口号，默认是1099。也是可选参数。</li></ul> <h4 id="jconsole"><a href="#jconsole" class="header-anchor">#</a> JConsole</h4> <blockquote><p>在<code>/jdk/bin</code>目录下<code>jconsole.exe</code>，如果上面的<code>内存</code>页签相当于可视化的<code>jstat</code>命令的话，
<code>线程</code>页签的功能相当于可视化的<code>jstack</code>命令，遇到线程停顿时可以使用这个页签进行监控分析。</p></blockquote> <blockquote><p>线程长时间停顿的主要原因主要有：等待外部资源（数据库连接、网络资源、设备资源等）、死循环、锁等待（活锁和死锁）</p></blockquote> <p><strong>查看hostname</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token function">hostname</span> -i
</code></pre></div><blockquote><p>如果hostname为<code>127.0.0.1</code>就需要修改，<code>vi /etc/hosts</code>将其第一行<code>127.0.0.1 localhost.localdomain localhost</code>中的<code>127.0.0.1</code>
修改为：<code>本服务器IP</code>，重启Linux，在服务器上输入<code>hostname -i</code>，查看实际设置的IP地址是否为你设置的</p></blockquote> <h4 id="jps"><a href="#jps" class="header-anchor">#</a> jps</h4> <blockquote><p><code>jps</code>命令（<a href="https://docs.oracle.com/en/java/javase/11/tools/jps.html#GUID-6EB65B96-F9DD-4356-B825-6146E9EEC81E" target="_blank" rel="noopener noreferrer">帮助文档<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>）
用于列出正在运行的虚拟机进程信息，</p></blockquote> <p><strong>命令格式如下：</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code>jps <span class="token punctuation">[</span> -q <span class="token punctuation">]</span> <span class="token punctuation">[</span> -mlvV <span class="token punctuation">]</span><span class="token punctuation">[</span>hostid <span class="token punctuation">]</span>
jps <span class="token punctuation">[</span> -help <span class="token punctuation">]</span>
</code></pre></div><blockquote><p>在默认情况下，jps的输出信息包括 Java 进程的进程ID以及主类名。jps还提供一些参数用于打印详细的信息。</p></blockquote> <p><strong>其中<code>-q</code>仅显示虚拟机的进程id，<code>-mlvV</code>的意义如下：</strong></p> <ul><li><code>-m</code> 将打印传递给主类的参数</li> <li><code>-l</code> 将打印模块名以及包名</li> <li><code>-v</code> 将打印传递给虚拟机的参数</li> <li><code>-V</code> 将打印传递给主类的参数、jar文件名等</li></ul> <h4 id="jstat"><a href="#jstat" class="header-anchor">#</a> jstat</h4> <blockquote><p><code>jstat</code>（<a href="https://docs.oracle.com/en/java/javase/11/tools/jstat.html#GUID-5F72A7F9-5D5A-4486-8201-E1D1BA8ACCB5" target="_blank" rel="noopener noreferrer">帮助文档<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>）
是用于监视虚拟机各种运行状态信息的命令行工具，它可以显示本地或者远程虚拟机进程中的类加载、内存、垃圾回收等信息</p></blockquote> <p><strong>命令格式如下</strong></p> <div class="language- extra-class"><pre class="language-text"><code>用法：jstat -help|-options
     jstat -&lt;option&gt; [-t] [-h&lt;lines&gt;] &lt;vmid&gt; [&lt;interval&gt; [&lt;count&gt;]]

定义：
  &lt;option&gt; -options选项报告的选项
  &lt;vmid&gt;虚拟机标识符。 vmid采用以下形式：
                     &lt;lvmid&gt; [@ &lt;主机名&gt; [：&lt;端口&gt;]]
                其中&lt;lvmid&gt;是目标的本地vm标识符
                Java虚拟机，通常是进程ID; &lt;hostname&gt;是
                运行目标Java虚拟机的主机的名称;
                和&lt;port&gt;是rmiregistry的端口号
                目标主持人。有关更完整的信息，请参阅jvmstat文档
                虚拟机标识符的描述。
  &lt;lines&gt;标题行之间的样本数。
  &lt;interval&gt;采样间隔。允许以下表格：
                    &lt;N&gt; [ “MS” | “S”]
                其中&lt;n&gt;是一个整数，后缀指定单位为
                毫秒（“ms”）或秒（“s”）。默认单位为“ms”。
  &lt;count&gt;终止前要采取的样本数。
  -J &lt;flag&gt;将&lt;flag&gt;直接传递给运行时系统。
</code></pre></div><blockquote><p>其中<code>vmid</code>全称是<code>Virtual Machine Identifier</code>，就是jps命令显示的进程id，如果是远程虚拟机进程</p></blockquote> <p><strong><code>vmid</code>的格式如下</strong></p> <div class="language- extra-class"><pre class="language-text"><code>[protocol:][//]lvmid[@hostname[:port]/servername]
</code></pre></div><p><strong><code>jstat</code>命令包含很多的子命令，主要分为3类</strong></p> <ul><li>类加载（<code>-class</code>）</li> <li>即时编译（<code>-compiler</code>和<code>-printcompilation</code>）</li> <li>垃圾回收（<code>-gc*</code>）</li></ul> <p><strong>输入<code>jstat -options</code>显示如下</strong></p> <div class="language- extra-class"><pre class="language-text"><code>-class
-compiler
-gc
-gccapacity
-gccause
-gcmetacapacity
-gcnew
-gcnewcapacity
-gcold
-gcoldcapacity
-gcutil
-printcompilation
</code></pre></div><ul><li><code>jstat [ generalOption | outputOptions vmid [interval[s|ms] [count]] ]</code> <ul><li><code>generalOption</code> 一般使用-gcutil查看GC情况</li> <li><code>vmid</code> 虚拟机进程号，即当前运行的java进程号</li> <li><code>interval</code> 间隔时间，单位为秒或毫秒</li> <li><code>count</code> 打印次数，如果缺省则打印无数次</li></ul></li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># 每2秒输出一次内存情况，连续输出100次</span>
jstat -gcutil <span class="token operator">&lt;</span>pid<span class="token operator">&gt;</span> <span class="token number">2000</span> <span class="token number">100</span>
jstat -gcutil <span class="token variable"><span class="token variable">$(</span>pgrep java<span class="token variable">)</span></span> <span class="token number">2000</span> <span class="token number">100</span>

<span class="token comment"># 输出heap各个分区大小，垃圾收集情况</span>
<span class="token comment"># 每隔2秒打印一次，共打印2次</span>
jstat -gc <span class="token operator">&lt;</span>pid<span class="token operator">&gt;</span> 2s <span class="token number">2</span>
jstat -gc <span class="token variable"><span class="token variable">$(</span>pgrep java<span class="token variable">)</span></span> 2s <span class="token number">2</span>
</code></pre></div><blockquote><p>JVM堆是分代的，前四个表示<code>Survivor</code>区的容量（Capacity）和已使用量（Utilization），EC表示当前Eden的容量，在翻阅文档的时候，
发现没有<code>CGC</code>和<code>CGCT</code>的解释，它们分别代表并发<code>GC Stop-The-World</code>的次数和时间。</p></blockquote> <h3 id="故障检测和修理工具"><a href="#故障检测和修理工具" class="header-anchor">#</a> 故障检测和修理工具</h3> <ul><li><a href="https://mingshan.fun/2018/10/21/monitoring-diagnostic-tools-for-jvm-cmd" target="_blank" rel="noopener noreferrer">Java虚拟机的监控及诊断工具（命令行）<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <table><thead><tr><th>工具名称</th> <th>用途</th></tr></thead> <tbody><tr><td>jinfo.exe</td> <td>配置或打印某个Java进程VM flag</td></tr> <tr><td>jhat.exe</td> <td>堆储存查看器</td></tr> <tr><td>jmap.exe</td> <td>Java内存图</td></tr> <tr><td>jsadebugd.exe</td> <td>Java的 Serviceability Agent Debug的守护进程</td></tr> <tr><td>jstack.exe</td> <td>Java堆栈跟踪</td></tr></tbody></table> <h4 id="jinfo"><a href="#jinfo" class="header-anchor">#</a> jinfo</h4> <blockquote><p><code>jinfo</code>命令（<a href="https://docs.oracle.com/en/java/javase/11/tools/jinfo.html#GUID-69246B58-28C4-477D-B375-278F5F9830A5" target="_blank" rel="noopener noreferrer">帮助文档<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>）
用来实时地查看和调整虚拟机的各项参数。</p></blockquote> <blockquote><p>我们可以使用<code>jps -v</code>来查看传递给虚拟机的参数，即<code>System.getProperty</code>获取的<code>-D</code>参数，现在我们可以利用<code>jinfo</code>命令来获取了。</p></blockquote> <p><strong>命令格式如下</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code>jinfo <span class="token punctuation">[</span>option<span class="token punctuation">]</span> pid
</code></pre></div><ul><li><code>-flag name</code> 打印指定的虚拟机参数的名称和值</li> <li><code>-flag [+|-]name</code> 用来修改目标<code>Java</code>进程的<code>manageable</code>虚拟机参数。其中<code>+</code>代表开启，<code>-</code>代表关闭。命令：<code>java -XX:+PrintFlagsFinal -version | grep manageable</code></li> <li><code>-flag name=value</code> 设置指定的虚拟机参数的值</li> <li><code>-flags</code>  打印全部的虚拟机参数，例如：<code>jinfo -flags 26792</code></li> <li><code>-sysprops</code> 打印<code>java</code>系统参数（<code>Java System Properties</code>）</li></ul> <h4 id="jmap"><a href="#jmap" class="header-anchor">#</a> jmap</h4> <blockquote><p><code>jmap</code>命令（<a href="https://docs.oracle.com/en/java/javase/11/tools/jmap.html#GUID-D2340719-82BA-4077-B0F3-2803269B7F41" target="_blank" rel="noopener noreferrer">帮助文档<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>）
用于生成堆转储快照，用于分析Java虚拟机堆中的对象。</p></blockquote> <p><strong>命令格式为</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code>jmap <span class="token punctuation">[</span>options<span class="token punctuation">]</span> pid
</code></pre></div><p><strong>参数选项</strong></p> <ul><li><code>-clstats</code> 连接到正在运行的进程并打印Java堆被加载类的统计信息</li> <li><code>-finalizerinfo</code> 连接到正在运行的进程并打印所有待 finalize 的对象。</li> <li><code>-histo[:live]</code> 连接到正在运行的进程并统计各个类的实例数目以及占用内存，并按照内存使用量从多至少的顺序排列。只统计堆中还在存活的对象。</li> <li><code>-dump</code>连接到正在运行的进程并导出Java虚拟机堆内存的快照。
<ul><li><code>live</code> 只保存堆中存活的对象</li> <li><code>format=b</code> 将使<code>jmap</code>导出与<code>hprof</code>（在<code>Java 9</code>中已被移除）<code>-XX:+HeapDumpAfterFullGC</code>、<code>-XX:+HeapDumpOnOutOfMemoryError</code>格式一样的文件</li> <li><code>file=filename</code> 指定导出堆内存快照的位置</li></ul></li></ul> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># 生成dump文件</span>
jmap -dump:live,format<span class="token operator">=</span>b,file<span class="token operator">=</span>heap.hprof <span class="token variable"><span class="token variable">$(</span>pgrep java<span class="token variable">)</span></span>
</code></pre></div><h4 id="jstack"><a href="#jstack" class="header-anchor">#</a> jstack</h4> <blockquote><p><code>jstack</code>命令（<a href="https://docs.oracle.com/en/java/javase/11/tools/jstack.html#GUID-721096FC-237B-473C-A461-DBBBB79E4F6A" target="_blank" rel="noopener noreferrer">帮助文档<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>）
可以用来打印目标<code>Java</code>进程中各个线程的栈轨迹，以及这些线程所持有的锁。</p></blockquote> <blockquote><p>通过线程的栈轨迹可以定位线程长时间停顿的原因，如线程间死锁、死循环、请求外部资源导致长时间等待等。</p></blockquote> <p><strong>命令格式如下</strong></p> <div class="language- extra-class"><pre class="language-text"><code>用法：
     jstack [-l] &lt;pid&gt;
         （连接到正在运行的进程）
     jstack -F [-m] [-l] &lt;pid&gt;
         （连接到挂起的进程）
     jstack [-m] [-l] &lt;executable&gt; &lt;core&gt;
         （连接到核心文件）
     jstack [-m] [-l] [server_id @] &lt;远程服务器IP或主机名&gt;
         （连接到远程调试服务器）

选项：
     -F强制进行线程转储。 当jstack &lt;pid&gt;没有响应时（进程挂起）时使用
     -m打印java和本机帧（混合模式）
     -l长列表。 打印有关锁的其他信息
     -h或-help打印此帮助消息
</code></pre></div><p><strong>线程的状态</strong></p> <blockquote><p>在输出的信息中，会包含，下面是常见的线程状态：</p></blockquote> <ul><li><code>RUNNABLE</code> 线程处于执行中</li> <li><code>BLOCKED</code> 线程被阻塞</li> <li><code>WAITING</code> 线程正在等待</li> <li><code>TIMED_WAITING</code> 超时等待</li></ul> <p><strong>示例</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># 获取到线程的dump日志</span>
jstack -l <span class="token variable"><span class="token variable">$(</span>pgrep java<span class="token variable">)</span></span> <span class="token operator">&gt;</span>dump.log

<span class="token comment"># 将所有线程信息输入到指定文件中</span>
jstack -F <span class="token variable"><span class="token variable">$(</span>pgrep java<span class="token variable">)</span></span> <span class="token operator">&gt;</span> jvm.log
</code></pre></div><h4 id="jcmd"><a href="#jcmd" class="header-anchor">#</a> jcmd</h4> <blockquote><p><code>jcmd</code>命令（<a href="https://docs.oracle.com/en/java/javase/11/tools/jcmd.html#GUID-59153599-875E-447D-8D98-0078A5778F05" target="_blank" rel="noopener noreferrer">帮助文档<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>）
可以向运行中的<code>Java</code>虚拟机(<code>JVM</code>)发送诊断命令。</p></blockquote> <p><strong>命令格式如下</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code>jcmd <span class="token operator">&lt;</span>pid <span class="token operator">|</span> main class<span class="token operator">&gt;</span> <span class="token operator">&lt;</span>command <span class="token punctuation">..</span>. <span class="token operator">|</span> PerfCounter.print <span class="token operator">|</span> -f  file<span class="token operator">&gt;</span>
jcmd -l
jcmd -h
</code></pre></div><p><strong>参数</strong></p> <ul><li><code>pid</code> 虚拟机的进程id</li> <li><code>main class</code> 接收诊断命令请求的进程的main类。</li> <li><code>command</code></li></ul> <blockquote><p>该命令必须是针对所选JVM的有效<code>jcmd</code>命令。</p></blockquote> <blockquote><p><code>jcmd</code>的可用命令列表是通过运行<code>help</code>命令(<code>jcmd pid help</code>)获得的，其中<code>pid</code>是运行<code>Java</code>进程的进程ID。</p></blockquote> <blockquote><p>如果<code>pid</code>为0，命令将被发送到所有的<code>Java</code>进程。<code>main class</code>参数将用于部分或完全匹配用于启动<code>Java</code>的类。</p></blockquote> <blockquote><p>如果没有提供任何选项，会列出正在运行的<code>Java</code>进程标识符以及用于启动进程的主类和命令行参数(与使用<code>-l</code>相同)。</p></blockquote> <ul><li><code>Perfcounter.print</code> 打印目标<code>Java</code>进程上可用的性能计数器。性能计数器的列表可能会随着<code>Java</code>进程的不同而产生变化。</li> <li><code>-f file</code> 从文件file中读取命令，然后在目标<code>Java</code>进程上调用这些命令。</li> <li><code>-l</code> 查看所有的进程列表信息。</li> <li><code>-h</code> 查看帮助信息。（同<code>-help</code>）</li></ul> <p><strong>查看可用命令</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code>jcmd <span class="token variable"><span class="token variable">$(</span>pgrep java<span class="token variable">)</span></span> <span class="token builtin class-name">help</span>
</code></pre></div><p><strong>示例</strong></p> <div class="language-bash extra-class"><pre class="language-bash"><code><span class="token comment"># 生成dump文件</span>
jcmd <span class="token operator">&lt;</span>pid<span class="token operator">&gt;</span> GC.heap_dump /home/heap.hprof
</code></pre></div><h3 id="其他工具"><a href="#其他工具" class="header-anchor">#</a> 其他工具</h3> <table><thead><tr><th>工具名称</th> <th>用途</th></tr></thead> <tbody><tr><td>jabswitch.exe</td> <td>Java Access Bridge Switch的简称，用于控制Java访问桥的开/关。Java访问桥是一种技术，让Java应用程序实现Accessibility API，以供Microsoft Windows系统的辅助技术访问。</td></tr> <tr><td>javafxpackager.exe</td> <td>JavaFX打包工具</td></tr> <tr><td>jrunscript.exe</td> <td>运行脚本</td></tr></tbody></table> <h2 id="远程监控参数"><a href="#远程监控参数" class="header-anchor">#</a> 远程监控参数</h2> <blockquote><p>在jvm启动参数中加入或在Tomcat的<code>/bin/catalina.sh</code>文件中加入</p></blockquote> <div class="language-bash extra-class"><pre class="language-bash"><code>-Djava.rmi.server.hostname<span class="token operator">=</span>主机的IP
-Dcom.sun.management.jmxremote.port<span class="token operator">=</span>端口号
-Dcom.sun.management.jmxremote.ssl<span class="token operator">=</span>false
-Dcom.sun.management.jmxremote.authenticate<span class="token operator">=</span>false
</code></pre></div><h2 id="远程debug参数"><a href="#远程debug参数" class="header-anchor">#</a> 远程Debug参数</h2> <blockquote><p>注意参数一定要放在<code>-jar</code>命令之前，方可运行成功</p></blockquote> <div class="language-bash extra-class"><pre class="language-bash"><code>java -Djavax.net.debug<span class="token operator">=</span>all -Xdebug -Xnoagent -Djava.compiler<span class="token operator">=</span>NONE <span class="token punctuation">\</span>
-Xrunjdwp:transport<span class="token operator">=</span>dt_socket,server<span class="token operator">=</span>y,suspend<span class="token operator">=</span>n,address<span class="token operator">=</span>端口 -jar jar包
</code></pre></div><div class="language-bash extra-class"><pre class="language-bash"><code>-agentlib:jdwp<span class="token operator">=</span>transport<span class="token operator">=</span>dt_socket,server<span class="token operator">=</span>y,suspend<span class="token operator">=</span>n,address<span class="token operator">=</span>端口 -jar jar包
</code></pre></div><p><strong>参数说明</strong></p> <ul><li><code>-Djavax.net.debug</code> 查看调试信息，<code>all</code> 代表所有，其他有<code>SSL</code>,<code>handshake</code>,<code>date</code>,<code>trust manager</code></li> <li><code>-Xdebug</code> 是通知JVM工作在DEBUG模式下</li> <li><code>-Xnoagent</code> 禁用默认sun.tools.debug调试器。</li> <li><code>-Djava.compiler=NONE</code> 为了加快debug的速度，禁止JIT编译器的加载，<a href="https://www.iteye.com/problems/89141" target="_blank" rel="noopener noreferrer">详细说明<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><code>-Xrunjdwp</code> 是通知JVM使用(Java debug wire protocol)来运行调试环境。
<ul><li><code>transport=dt_socket</code> 是指调试数据用SOCKET模式传送</li> <li><code>transport=dt_shmem</code> 指用共享内存方式</li> <li><code>transport=dt_shmem</code> 只适用于Windows平台。</li> <li><code>server=y/n</code> VM是否需要作为调试服务器执行。</li> <li><code>suspend=y/n</code> 是否在调试客户端建立连接之后启动 VM 。(设置为y时启动不了)</li> <li><code>onthrow=java.io.IOException</code> 指明，当产生该类型的Exception时，JVM就会中断下来，进行调式。可选参数</li> <li><code>launch=/sbin/echo</code> 指明，当JVM被中断下来时，执行的可执行程序。可选参数</li> <li><code>onuncaught=y/n</code> 指明，出现uncaught exception 后，是否中断JVM的执行.</li></ul></li></ul></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/woytu/notes-vuepress/edit/master//Java/JDK工具.md" target="_blank" rel="noopener noreferrer">在 GitHub 上编辑此页</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2021-07-09 20:04:13</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/Java/JDK安装配置.html" class="prev">
        JDK安装配置
      </a></span> <span class="next"><a href="/Java/Java构建管理.html">
        Java构建管理
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><!----></div></div>
    <script src="/assets/js/app.269009d6.js" defer></script><script src="/assets/js/3.974b9720.js" defer></script><script src="/assets/js/26.da141fb8.js" defer></script>
  </body>
</html>
